<?php
/**
http://localhost/FloaterServer/namespace/controller/action?key=value

**/
class CDispatcher{
	
	
	private $request;
	
	
	public function CDispatcher($request){
		$this->request = $request;
	}

	
	public function dispatch(){
		$this->exec($this->request->getParams());
	}
	
	
	private function exec($exe_arg){
	
		//print_r($exe_arg);
		$controller = $exe_arg['controller'].'Controller';
		$action = $exe_arg['action'];
		$args = $exe_arg['args'];  //array
		
		App::load('Controller', $controller);
		
		$clazz = new $controller();
		$clazz->request = $this->request;
		$clazz->action = $action;
		$clazz->execute(); 
		
		/*
		$class = new ReflectionClass($controller);
		$method = $class->getMethod($action);
		
		$obj = $class->newInstance();
		$method->invoke($obj);
		*/
		
	
	}
	
	public function sayHello(){
		echo 'hello';
	}
	

}


?>